import requests
import config
class StaffAPI:
    def add_staff(self,add_data,token):
        url = config.BATH_URL + "/api/sys/user"
        # add_data = {
        #     "username":"jack0709t2",
        #     "mobile":"13298541303",
        #     "timeOfEntry":"2020-07-09",
        #     "formOfEmployment":1,
        #     "workNumber":"10086",
        #     "departmentName":"销售",
        #     "departmentId":"1266699057968001024",
        #     "correctionTime":"2020-07-30T16:00:00.000Z"
        # }
        headers_data = {
            "Authorization": token
        }
        response = requests.post(url=url,json=add_data,headers=headers_data)
        return response
    def updata_staff(self,user_id,updata_data,token):
        url = config.BATH_URL + "/api/sys/user/{}".format(user_id)
        headers_data = {
            "Authorization": token
        }
        response = requests.put(url=url,json=updata_data,headers=headers_data)
        return response
    def select_staff(self,user_id,token):
        url = config.BATH_URL + "/api/sys/user/{}".format(user_id)
        headers_data = {
            "Authorization": token
        }
        response = requests.get(url=url,headers=headers_data)
        return response
    def delect_staff(self,user_id,token):
        url = config.BATH_URL + "/api/sys/user/{}".format(user_id)
        headers_data = {
            "Authorization": token
        }
        response = requests.delete(url=url,headers=headers_data)
        return response
if __name__ == '__main__':
    pass
    # print(StaffAPI().add_staff().json())